package com.geek.javase.ch03.test5;
/*
 *@author wangpeng
 *2025/10/12 22:12
 *@description TODO
 */

public abstract class Role {
    private String name;
    private String level;
    private int blood;
    private int power;
    private int defence;
    private String kind;

    //1.基本攻击方法
    public abstract void attack(Role role);


    //2. 死亡判断方法 false 表示活着，true表示死亡
    public boolean isDead(){
        if (this.blood <= 0){
            return true;
        }else {
            return false;
        }
    }

    //3.获取信息的方法
    public void show(){
        System.out.print("角色名称：" + getName() + '\t');
        System.out.print("角色等级：" + getLevel() + '\t');
        System.out.print("角色血量：" + getBlood() + '\t');
        System.out.print("角色攻击力：" + getPower() + '\t');
        System.out.print("角色防御力：" + getDefence() + '\t');
        System.out.println("角色类别：" + getKind());
    }

    //构造方法

    public Role() {
    }

    public Role(String name, String level ,int blood, int power, int defence, String kind) {
        this.name = name;
        this.level = level;
        this.blood = blood;
        this.power = power;
        this.defence = defence;
        this.kind = kind;
    }

    //----------get/set方法

    public int getBlood() {
        return blood;
    }

    public void setBlood(int blood) {
        this.blood = blood;
    }

    public int getDefence() {
        return defence;
    }

    public void setDefence(int defence) {
        this.defence = defence;
    }

    public String getKind() {
        return kind;
    }

    public void setKind(String kind) {
        this.kind = kind;
    }

    public String getLevel() {
        return level;
    }

    public void setLevel(String level) {
        this.level = level;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getPower() {
        return power;
    }

    public void setPower(int power) {
        this.power = power;
    }

    @Override
    public String toString() {
        return "Role{" +
                "blood=" + blood +
                ", name='" + name + '\'' +
                ", level='" + level + '\'' +
                ", power=" + power +
                ", defence=" + defence +
                ", kind='" + kind + '\'' +
                '}';
    }
}
